package Chapter6.dao;

import learnning.dao.base.HibernateDao;

import org.hibernate.HibernateException;

import Chapter6.join.Book_C6_Join;
import Chapter6.join.Detail_Book_C6_Join;

public class Book_C6_JoinDao extends HibernateDao {
	public void add(String name, String author, String absName) {
		try {
			begin();
			Detail_Book_C6_Join detail = new Detail_Book_C6_Join(author);
			detail.setName(name);
			getSession().save(detail);
			Book_C6_Join book = new Book_C6_Join(absName);
			getSession().save(book);
			commit();
		} catch (HibernateException e) {
			rollback();
			e.printStackTrace();
		}
	}
}
